@namespace SwashbucklerDiary.Rcl.Pages
@inherits FocusDialogComponentBase

<CustomMDialog MyValue="Visible"
                  MyValueChanged="InternalVisibleChanged"
                  ContentClass="rounded-lg"
                  MaxWidth="480"
                  DisableAutoFocus
                  OnAfterShowContent="FocusAsync"
                  OnBeforeShowContent="BeforeShowContent">
    <MForm @ref="@mForm"
           Model="@configModel"
           OnValidSubmit="HandleOnOK"
           EnableI18n="true">
        <MCard>
            <MCardTitle Class="font-weight-bold flex-nowrap">
                <wc-auto-scroll-text>@(I18n.T("Config"))</wc-auto-scroll-text>
                <MSpacer></MSpacer>
                <MButton Icon="true" OnClick="HandleOnCancel">
                    <MIcon>close</MIcon>
                </MButton>
            </MCardTitle>
            <MCardText Class="pb-0">
                <MTextField @bind-Value="configModel.ServerAddress"
                            @ref="textField"
                            Dense
                            MinHeight="48"
                            Filled
                            Rounded
                            spellcheck="false"
                            Placeholder="@(I18n.T("Server address"))">
                </MTextField>
                <MTextField @bind-Value="configModel.Account"
                            Dense
                            MinHeight="48"
                            Filled
                            Rounded
                            spellcheck="false"
                            Placeholder="@(I18n.T("Account"))">
                </MTextField>
                <MTextField @bind-Value="configModel.Password"
                            Dense
                            MinHeight="48"
                            Filled
                            Rounded
                            spellcheck="false"
                            Placeholder="@(I18n.T("Password"))"
                            AppendIcon="@(showPassword ? "visibility" : "visibility_off")"
                            Type="@(showPassword ? "text" : "password")"
                            OnAppendClick="() => showPassword = !showPassword">
                </MTextField>
            </MCardText>
            <MCardActions Class="pt-0">
                <MSpacer></MSpacer>
                <MButton Text="true" OnClick="HandleOnCancel">
                    @(I18n.T("Cancel"))
                </MButton>
                <MButton Text="true"
                         Type="submit"
                         Color="primary">
                    @(I18n.T("OK"))
                </MButton>
            </MCardActions>
        </MCard>
    </MForm>
</CustomMDialog>
